package com.luluteam.pushlib.tools;

import android.content.Intent;

import com.luluteam.pushlib.constant.AppHolder;
import com.luluteam.pushlib.constant.CtxConstant;
import com.luluteam.pushlib.service.LocationService;


/**
 * @author Guan
 * @date Created on 2018/11/21
 */
public class JumpHelper {


    /**
     * 开启定位Service
     * contextAction默认为2：client在阅读Msg的时候上报的情景信息
     */
    public static final void gotoLocationService(String messageId, int rating, long duration, int wordCount) {
        Intent intent = new Intent(AppHolder.appContext, LocationService.class);
        intent.putExtra("messageId", messageId);
        intent.putExtra("rating", rating);
        intent.putExtra("duration", duration);
        intent.putExtra("wordCount", wordCount);
        intent.putExtra("action", CtxConstant.ACTION_MSG);
        AppHolder.appContext.startService(intent);
    }

    /**
     * 参考 CtxContext中的Action
     * <p>
     * 0：只是单纯的上报情景信息
     * 1：上报情景信息，同时服务器需要进行基于情景上下文的推荐
     */
    public static final void gotoLocationService(int contextAction, String jsonTag) {
        Intent intent = new Intent(AppHolder.appContext, LocationService.class);
        intent.putExtra("action", contextAction);
        intent.putExtra("jsonTag", jsonTag);
        AppHolder.appContext.startService(intent);
    }


}
